// pages/mine/mine.js
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    //tabbar
    tabbar: {},
    UserInfodata:{
      san:true
    },
    
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    app.editTabbar();
    wx.getStorage({
      key: 'token',
      success :(res)=> {
        this.setData({
          UserInfodata:res.data
        })
      }
    })
  },
  gituserinfo(){
    wx.getUserProfile({
      desc: '展示用户信息',
      success: (res) => {
        this.setData({
          
          UserInfodata:res.userInfo,
          wx:wx.setStorage({
            data: res.userInfo,
            key: 'token',
            success: (res) => {},
            fail: (res) => {},
            complete: (res) => {},
          })
        })
        this.data.UserInfodata.san = false
      },
    })
  },
  logonOut(){
    wx.showModal({
      title:'温情提示',
      content:'退出后将无法获取您的相对信息',
      success:(res)=>{
        if (res.confirm) {
          this.setData({
            UserInfodata: {
              san:true
            },
            wx:wx.removeStorage({
              key: 'token',
            })
          })
        } else if (res.cancel) {
          console.log('用户点击取消')
        }
      }
    })

  },


  
})